package cn.sail.shop3.api.controller;

import cn.sail.shop3.api.entity.Goods;
import cn.sail.shop3.api.service.GoodsService;
import cn.sail.shop3.api.service.impl.GoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/goodsList")
public class GoodsListServlet extends BaseServlet {

    private GoodsService goodsService = new GoodsServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("goodsListServlet");
        //获取系统中商品列表数据
        List<Goods> dbGoodsList = goodsService.listAll();
        System.out.println(dbGoodsList);
        //业务成功返回
        successResp(resp, dbGoodsList);

        System.out.println("456");
    }


}
